package com.web.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.web.dao.TWinTypeDao;
import com.web.model.PageBean;
import com.web.model.TWinType;
import com.web.service.TWinTypeService;
import com.web.utils.Pager;

/**
 * 奖项 Service实现
 * @author wzy
 * 
 */
@Service
public class TWinTypeServiceImpl implements TWinTypeService{

	@Autowired
	private TWinTypeDao winTypeDao;//注入TWinType的dao
	
	
	public int insert(TWinType winType){
		return winTypeDao.insert(winType);
	}
	
	
	public int deleteByPrimaryKey(Long winTypeId){
		return winTypeDao.deleteByPrimaryKey(winTypeId);
	}
	
	
	public int updateByPrimaryKey(TWinType winType){
		return winTypeDao.updateByPrimaryKey(winType);
	}

	
	public TWinType selectByPrimaryKey(Long winTypeId){
		return winTypeDao.selectByPrimaryKey(winTypeId);
	}
	
	
	
	public PageBean<TWinType> selectListByPage(Map<String,Object> map){
		Pager.addPage(map);
		Integer count = winTypeDao.selectListCount(map);
		List<TWinType> list = winTypeDao.selectList(map);
		PageBean<TWinType> pageList = new PageBean<TWinType>(list);
		pageList.setTotal(count);
		pageList.setList(list);
		pageList.setPageNum((Integer)map.get("pageNum"));
		pageList.setPageSize((Integer)map.get("pageSize"));
		pageList.setPages(Pager.getPages(count, (Integer)map.get("pageSize")));
		return pageList;
	}
	
	
	public TWinType selectByModelSelective(TWinType winType){
		return  winTypeDao.selectByModelSelective(winType);
	}
	
	
	public int selectListCount(Map<String, Object> map){
		return winTypeDao.selectListCount(map);
	}

	
	public List<TWinType> selectList(Map<String, Object> map) {
		return winTypeDao.selectList(map);
	}

	
	public void insertList(List<TWinType> list) {
		winTypeDao.insertList(list);	
	}
}
